package com.thoughtworks.biblioteca.command;

import java.util.Map;

public class Invoker {
    private Map commMap;

    public void addComm(String commName, ICommand command) {
        commMap.put(commName, command);
    }

    public void request(String commName) {
        ICommand command = (ICommand) commMap.get(commName);
        if (command == null) {
            command = new InvalidOperation();
        }
        command.doExecute();
    }

    public Map getCommMap() {
        return commMap;
    }

    public void setCommMap(Map commMap) {
        this.commMap = commMap;
    }
}
